package com.leetCode.problem;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2021-12-24 17:27:38
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-12-24     张李鑫                     1.0         1.0 Version
 */
public class Problem7 {
    public static int reverse(int x) {
        long res = 0;
        while (x != 0) {
            res = (res * 10) + x % 10;
            x /= 10;
        }

        if (res > ((2 << 30) - 1)||res<(2<<30)+1) {
            return 0;
        }
        return (int) res;
    }

    public static void main(String[] args) {
        System.out.println((reverse(0)));
    }
}
